import { hasOwn } from "../share/index"


const publicPropertiesMap = {
  $el:(instance)=> instance.vnode.el,
  $slots:(instance)=> instance.slots
}
export const publicInstanceHandler = {
  get(target, key) {
    const {setupState, props} = target
    if(hasOwn(setupState,key)) {
      return setupState[key]
    } else if(hasOwn(props, key)){
      return props[key]
    }
    const publicGetter = publicPropertiesMap[key]
    if(publicGetter) {
      return publicGetter(target)
    }
  }
}